package com.example.campustalent.view

import android.content.Context
import android.view.Gravity
import android.view.View
import android.view.animation.Animation
import android.widget.TextView
import com.example.campustalent.R
import razerdp.basepopup.BasePopupWindow

/**
 *@author: wangtianxiong
 *@time: 2022/3/11
 *@describe:
 *
 */
class PerfectInformationDialog(context: Context) : BasePopupWindow(context) {
    interface OnItemClick{
        fun confirm()
    }
    private var mCallback: OnItemClick? = null
    init {
        popupGravity = Gravity.CENTER
        initView()
    }
    private fun initView(){
        findViewById<TextView>(R.id.tv_confirm).setOnClickListener {
            mCallback?.confirm()
        }
    }
    override fun onCreateContentView(): View {
        return createPopupById(R.layout.dialog_perfect_infomation)
    }

    override fun setAdjustInputMethod(needAdjust: Boolean): BasePopupWindow {
        return super.setAdjustInputMethod(needAdjust)
    }
    override fun onCreateShowAnimation(): Animation {
        return defaultScaleAnimation
    }

    override fun onCreateDismissAnimation(): Animation {
        return getDefaultScaleAnimation(false)
    }

    override fun isAllowDismissWhenTouchOutside(): Boolean {
        return false
    }
    fun setOnItemClick(callback: OnItemClick){
        mCallback = callback
    }
}